home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
5
/
CHASSIS_
/
TEXTCLOS.C
< prev
next >
Wrap
Text File
|
1992-05-14
|
2KB
|
67 lines
/************************************************************************************/
/* TextCloseProc */
/************************************************************************************/
#include "MyHeaders.h"
int TextCloseProc ()
{
int TCRetCode = 0;
int item;
if (windTbl[windSub].windPtr == 0) /* if window already closed */
goto ENDING; /* skip this whole thing */
if (windTbl[windSub].windTEChanged == TRUE)
{
GetWTitle(windTbl[windSub].windPtr, &workStr255);
ParamText (&workStr255,"","",""); /* set name */
PlaceAlert (139); /* position the alert */
item = CautionAlert (139, NIL); /* show the alert */
switch (item)
{
case (cancel):
TCRetCode = 2; /* indicate cancel */
goto ENDING;
break;
case (ok): /* for "save" */
WorkRetCode = FileSaveProc (FALSE); /* save, then fall thru */
if (WorkRetCode == 2) /* if it was a cancel */
{
TCRetCode = 2;
goto ENDING;
}
if (WorkRetCode != noErr) /* if error in save */
{
GetWTitle(windTbl[windSub].windPtr, &workStr255);
ParamText (&workStr255,"","","");
PlaceAlert (138); /* position the alert */
StopAlert (138, NIL); /* show the alert */
TCRetCode = 1; /* set bad return code */
goto ENDING; /* get out */
}
break;
}
}
/*for no save or fall thru from save */
if (windTbl[windSub].windPathRefNum != 0)
{
workRC = FSClose (windTbl[windSub].windPathRefNum); /* close */
if (workRC != noErr) /* if bad close */
{
TCRetCode = 1; /* set bad return */
goto ENDING; /* get out */
}
}
windTbl[windSub].windPathRefNum = 0; /* indicate file closed */
CloseWindow(windTbl[windSub].windPtr); /* close the window */
windTbl[windSub].windPtr = 0; /* indicate closed */
windTbl[windSub].windTEChanged = FALSE; /* initialize */
ENDING:
return TCRetCode;
}